// 分类相关api接口
import request from '@/utils/request'

// 1.获取所有分类
export const findAllCategoryAPI = () => {
  return request('/home/category/head', 'get')
}

/**
 * 获取顶级分类信息(children属性各个子分类)
 * @param {String} id 顶级分类id
 * @returns Promise
 */
export const findTopCategotyAPI = (id) => {
  return request('/category', 'get', { id })
}

/**
 * 二级类目-筛选条件
 * @param {String} subId 二级分类id
 * @returns Promise
 */
export const findFilterAPI = (subId) => {
  return request('/category/sub/filter', 'get', { id: subId })
}

/**
 * 获取分类下的商品
 * @param {*} params
 * @returns Promise
 */
export const findSubCategotyGoodsAPI = (params) => {
  return request('/category/goods/temporary', 'post', params)
}
